<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let stuArr = [];
    for (let i = 0; i < 9; i++) {
      stuArr.push(parseFloat(prompt("请输入第" + (i + 1) + "科的分数")));
    }

    function calculateSum(stuArr = []) {
      let sum = 0;
      for (let i = 0; i < stuArr.length; i++) {
        sum = sum + stuArr[i];
      }
      alert("学生的总分是：" + sum);
    }

    calculateSum(stuArr);
  </script>
</body>

</html>